<?php
	
	function getSalles()
	{
		$dir = 'Serveur\Accordeon\salles';
		if (is_dir ($dir))
			$dh = opendir ($dir);
		else 
			exit;
		
		$rooms = array();
		while (($file = readdir ($dh)) !== false ) 
		{
			$split = explode(".", $file);
			
			$ext = $split[1];
			if($ext == 'xml')
				$rooms[] = $split[0];
		}
		closedir ($dh); 
		return implode($rooms, ";");
	}
	
	if(isset($_GET['request']))
	{
		$type = $_GET['request'];
		if($type == 'type')
            echo getTypes();
		else if($type == 'periode')
            echo getPeriodes();
        else if($type == 'id')
            echo getIds();
		else if($type = 'salles')
			echo getSalles();
	}
	

?>
